<template>
    <div>
        <!-- <van-cell-group>
            <van-field v-model="name" label="姓名" placeholder="请输入用户名" />
            <van-field v-model="tmoney" label="金额" placeholder="请输入金额" />
            <van-field v-model="company_name" label="机构名称" placeholder="请输入机构名称" />
        </van-cell-group> -->
        <div >
            <el-form>
                <el-form-item label="姓名" style="padding-left: 30px">
                <el-input placeholder="请输入姓名" v-model="form.name" style="width: 400px;"/>
                </el-form-item>

                <el-form-item label="金额" style="padding-left: 30px">
                <el-input placeholder="请输入金额" v-model="form.tmoney" style="width: 400px;"/>
                </el-form-item>

                <el-form-item label="机构名称" style="padding-left: 30px">
                <el-input placeholder="请输入机构名称" v-model="form.company_name" style="width: 400px;"/>
                </el-form-item>

                <!-- {{companylist}} -->
                <el-form-item label="客户经理" style="padding-left: 15px">
                <el-select  v-model="form.manager_id" placeholder="请选择客户经理"  style="width: 400px;">
                    <el-option :label="i.name" :value="i.id" v-for="i in companylist" :key="i.id">{{i.name}}</el-option>
                </el-select>
                </el-form-item>

                <!-- {{rfromlist}} -->
                <el-form-item label="用户源" style="padding-left: 15px">
                <el-select  v-model="form.refromid" placeholder="请选择用户源"  style="width: 400px;">
                    <el-option :label="j.name" :value="j.id" v-for="j in rfromlist" :key="j.id">{{j.name}}</el-option>
                </el-select>
                </el-form-item>

                <van-button @click="add">提交</van-button>


            </el-form>
        </div>
    </div>
</template>

<script>
import maxios from '../http/axios'  
export default {
    data() {
        return {
            form:{'name':'','tmoney':'','company_name':'','manager_id':'','refromid':''},
            companylist:[],
            rfromlist:[],
        }
    },
    methods: {
        getcompany(){
            maxios('getcompany','get').then(res => {
                this.companylist = res.list
            })
        },
        getrefrom(){
            maxios('getrefrom','get').then(res => {
                this.rfromlist = res.list
            })
        },
        add(){
            maxios('addcustomer','post',this.form).then(res => {
                console.log(res.msg)
            })
        }
    },
    created() {
        this.getcompany()
        this.getrefrom()
    }
}
</script>

<style scoped>

</style>
